﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DingTalkAgent.Web.Models
{
    public class Operation
    {
        /// <summary>
        /// 写入操作日志
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="OperationType">操作类型</param>
        /// <param name="Msg">操作内容</param>
        /// <param name="LoginName">登录者</param>
        /// <returns></returns>
        public static int Add(string UserID, string OperationType, string Msg,string LoginName,string UnitCode="")
        {
            var Dal = new SqlData.Operate();
            var model = new Model.Operate() { 
                Site_ID=1,
                Op_Type = OperationType,
                Op_Msg=Msg,
                Opt_IP=Discuz.Common.DNTRequest.GetIP(),
                User_ID=UserID,
                LoginName = LoginName,
                Op_Time=DateTime.Now,
                UnitCode = UnitCode

            };
            return Dal.Add(model);
        }
    }
}